//
//  EMLoanDescTableViewCell.m
//  EasyMoney
//
//  Created by zh on 2020/1/11.
//  Copyright © 2020 zh. All rights reserved.
//

#import "EMLoanDescTableViewCell.h"

@interface EMLoanDescTableViewCell ()

@property (nonatomic, strong) UILabel *qaTextLabel;

@end

@implementation EMLoanDescTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI{

    self.contentView.backgroundColor = [UIColor whiteColor];
    UIImageView *iconImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"homeicon_1"]];
    [self.contentView addSubview:iconImageView];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.top.mas_equalTo(19);
        make.size.mas_equalTo(CGSizeMake(24, 24));
    }];

    UILabel *titleLabel = [[UILabel alloc]init];
    titleLabel.text = NSLocalizedString(@"新手问答", nil);
    titleLabel.textColor = ColorFromRGB(0x333333);
    titleLabel.font = FONT_PINGFANG_REGULAR_(20);
    [self.contentView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconImageView.mas_right).offset(2);
        make.top.mas_equalTo(18);
        make.right.mas_equalTo(-10);
    }];

    UIView *bgView = [[UIView alloc] init];
    bgView.layer.backgroundColor = [UIColor colorWithRed:248/255.0 green:248/255.0 blue:248/255.0 alpha:1.0].CGColor;;
    bgView.layer.cornerRadius = 4;
    bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(19);
        make.right.mas_equalTo(-19);
        make.top.equalTo(iconImageView.mas_bottom).offset(10);
        make.bottom.mas_equalTo(-10);
    }];

    self.qaTextLabel = [[UILabel alloc]init];
    self.qaTextLabel.numberOfLines = 0;
    self.qaTextLabel.textColor = ColorFromRGB(0x666666);
    self.qaTextLabel.font = FONT_PINGFANG_REGULAR_(16);
    [bgView addSubview:self.qaTextLabel];
    [self.qaTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(9);
        make.right.mas_equalTo(-34);
        make.top.mas_equalTo(7);
        make.bottom.mas_equalTo(-9);
    }];

    //nextIcon
    UIImageView *nextIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"nextIcon"]];
    [bgView addSubview:nextIcon];
    [nextIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-9);
        make.centerY.equalTo(bgView);
    }];

}

- (void)setQaTextString:(NSString *)qaTextString{
    _qaTextString = qaTextString;

    self.qaTextLabel.text = qaTextString;
}

@end
